package com.yangchao.ch02
/** 范围 **/
class Example11 {
    public static void main(String[] args) {
        // 1,2,..10
        def a = 1..10
        // 边界 1，2，...10
        def b =1..<10
        // 可以由字符组成
        def c='a'..'z'
        //降序排列
        def d=10..1
        //降序排列字母
        def e='z'..'a'

        println(a)
        println(a.toArray())  // 打印数组格式
        println(b.toArray())
        println(c.toArray())
        println(d.toArray())
        println(e.toArray())

        println("index 2 is "+c.get(2))  //取值，打印出c
        println("from="+d.getFrom())     //取下限值 1
        println("to="+d.getTo())         //取上限值 10
        println("Size="+c.size())      //长度
        println("a is reverse="+a.isReverse())  //false
        println("d is reverse="+d.isReverse())   //true
        println("d resver="+d.reverse())        //反转排序

    }
}
